﻿using NoMiddleman.Core.DataInterfaces;
using NoMiddleman.Data;
using NoMiddleman.Facades.Facades;
using StructureMap;
using StructureMap.Configuration.DSL;

namespace NoMiddleman.Web
{
    public static class BootStrapper
    {
        public static void ConfigureStructureMap()
        {
            StructureMapConfiguration.AddRegistry(new NoMiddlemanRegistry());
        }
    }

    public class NoMiddlemanRegistry : Registry
    {
        protected override void configure()
        {
            ForRequestedType<IClientRepository>().
                TheDefaultIsConcreteType<ClientRepository>().AsSingletons();

            //ForRequestedType<IRealEstateRepository>().
            //    TheDefaultIsConcreteType<RealEstateRepository>().AsSingletons();

            ForRequestedType<IAdvertRepository>().
                TheDefaultIsConcreteType<AdvertRepository>().AsSingletons();

            ForRequestedType<ClientFacade>().
                TheDefaultIsConcreteType<ClientFacade>();

            ForRequestedType<AdvertFacade>().
                TheDefaultIsConcreteType<AdvertFacade>();
        }
    }
}
